﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Management;
using System.Text;
using WMI.NET.Abstracts;

namespace WMI.NET.ComputerSystemHardware.MotherboardControllerPort
{
    /// <summary>
    /// The Win32_DeviceMemoryAddress WMI class represents a device memory address on a computer system running Windows.
    /// </summary>
    public class Win32_DeviceMemoryAddress : Win32_SystemMemoryResource
    {

        private string _MemoryType;

        /// <summary>
        /// Characteristics of the memory resource on the computer system running Windows. Values are the following.
        /// </summary>
        public string MemoryType { get { return _MemoryType; } } //TODO enum

        /// <summary>
        /// 
        /// </summary>
        /// <param name="mbo"></param>
        public Win32_DeviceMemoryAddress(ManagementBaseObject mbo)
            : base(mbo)
        {
            _MemoryType = mbo.GetStringValue("MemoryType");
        }


    }

    /// <summary>
    /// 
    /// </summary>
    public class GetWin32_DeviceMemoryAddresses : Win32Collection<Win32_DeviceMemoryAddress>
    {

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override ReadOnlyCollection<Win32_DeviceMemoryAddress> GetCollection()
        {
            List<Win32_DeviceMemoryAddress> tempCollection = new List<Win32_DeviceMemoryAddress>();

            foreach (var s in searcher.Get())
            {
                Win32_DeviceMemoryAddress tempListItem = new Win32_DeviceMemoryAddress(s);
                tempCollection.Add(tempListItem);
            }

            return tempCollection.AsReadOnly();
        }

        /// <summary>
        /// 
        /// </summary>
        public GetWin32_DeviceMemoryAddresses() : base("SELECT * FROM Win32_DeviceMemoryAddress") { }

    }

}
